{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# AutoEncoder Model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Why autoencoders?\n",
    "\n",
    "Machine learning is all about information. AutoEncoder was initially developed to capture that information.\n",
    "\n",
    "What do you mean by information? Well, information is the most crucial part of data. For example, if I'm trying to tell you: \"You are a beautiful human being\". You'll likely understand me when I say like a caveman: \"You, beautiful, human!\". Notice that the second sentence is much shorter than the first one, yet it's perfectly understandable by any person (and caveman). We say that the amount of information is the same in the first one and the second one. Weirdly enough, scientists like the second one (caveman version) better because it is shorter and takes less space on you computer.\n",
    "\n",
    "What an autoencoder does is no different. It takes in an input (image etc) and convert it into a more compact format."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## How autoencoders do this?\n",
    "\n",
    "Autoencoders do this by first reduce the size of the input array with layers after layers of processing, and then increase the size of the array also by multiple layers, until the size of the array is the same as the input. The array is then compared to the original input. If the difference is small, then congratulations, you have a good model (because it is able to preserve information). In this case, we take the smallest array along the processing path and say that the array is the most compressed (think in data flowing through the model). We call the compressed vector a **latent representation**. We separate the model into two parts, the part that processes the input into the compressed input is called **encoder**, and the part decompressing the compressed input is called **decoder**."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Why are autoencoders generative models?\n",
    "\n",
    "The decoder part of an autoencoder is a generative model.\n",
    "\n",
    "Why? Well, take an autoencoder and cover the encoder. You see that the decoder takes in a lower dimension input and gives a high dimension output that looks like real world examples. That's basically what every generative model does!"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
